//
//  WorkerResumeInfoModel.m
//  Btpin
//
//  Created by Vic on 2019/3/27.
//  Copyright © 2019 Vic. All rights reserved.
//

#import "WorkerResumeInfoModel.h"

@implementation WorkerResumeInfoModel

- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues {
    self.userid = [UIToolsControl dataAnalysis:keyedValues[@"userid"]];
    self.auth_status = [UIToolsControl dataAnalysis:keyedValues[@"auth_status"]];
    self.chat_status = [UIToolsControl dataAnalysis:keyedValues[@"chat_status"]];
    self.favorite_status = [UIToolsControl dataAnalysis:keyedValues[@"favorite_status"]];
    self.name = [UIToolsControl dataAnalysis:keyedValues[@"name"]];
    self.nickname = [UIToolsControl dataAnalysis:keyedValues[@"nickname"]];
    self.avatar = [UIToolsControl dataAnalysis:keyedValues[@"avatar"]];
    self.residence = [UIToolsControl dataAnalysis:keyedValues[@"residence"]];
    self.age = [UIToolsControl dataAnalysis:keyedValues[@"age"]];
    self.sex = [UIToolsControl dataAnalysis:keyedValues[@"sex"]];
    self.education_cn = [UIToolsControl dataAnalysis:keyedValues[@"education_cn"]];
    self.experience_cn = [UIToolsControl dataAnalysis:keyedValues[@"experience_cn"]];
    self.position = [UIToolsControl dataAnalysis:keyedValues[@"position"]];
    self.telephone = [UIToolsControl dataAnalysis:keyedValues[@"telephone"]];
    self.email = [UIToolsControl dataAnalysis:keyedValues[@"email"]];
    self.weixin = [UIToolsControl dataAnalysis:keyedValues[@"weixin"]];
    self.weixin_img = [UIToolsControl dataAnalysis:keyedValues[@"weixin_img"]];
    self.specialty = [UIToolsControl dataAnalysis:keyedValues[@"specialty"]];
    self.current = [UIToolsControl dataAnalysis:keyedValues[@"current"]];
    self.current_cn = [UIToolsControl dataAnalysis:keyedValues[@"current_cn"]];
    self.price = [UIToolsControl dataAnalysisForPrice:keyedValues[@"price"]];
    self.percent = [UIToolsControl dataAnalysis:keyedValues[@"percent"]];
    self.audit = [UIToolsControl dataAnalysis:keyedValues[@"audit"]];
    self.status = [UIToolsControl dataAnalysis:keyedValues[@"status"]];
    self.is_graduate = [UIToolsControl dataAnalysis:keyedValues[@"is_graduate"]];
    
//    self.intentionModel = [[WorkerResumeIntentionInfoModel alloc] init];
//    if (keyedValues[@"intention"]) {
//        [self.intentionModel setValuesForKeysWithDictionary:keyedValues[@"intention"]];
//    }
    self.intentionModel = [[ResumeIntentionInfoModel alloc] init];
    if (keyedValues[@"intention"]) {
        [self.intentionModel setValuesForKeysWithDictionary:keyedValues[@"intention"]];
    }
    
    self.workArray = [NSMutableArray arrayWithCapacity:0];
    if (keyedValues[@"work"] && [keyedValues[@"work"] count]) {
        for (NSDictionary *dic in keyedValues[@"work"]) {
            PMineResumeWorkInfoModel *model = [[PMineResumeWorkInfoModel alloc] init];
            [model setValuesForKeysWithDictionary:dic];
            [self.workArray addObject:model];
        }
    }
    
    self.educationArray = [NSMutableArray arrayWithCapacity:0];
    if (keyedValues[@"education"] && [keyedValues[@"education"] count]) {
        for (NSDictionary *dic in keyedValues[@"education"]) {
            PMineResumeEducationInfoModel *model = [[PMineResumeEducationInfoModel alloc] init];
            [model setValuesForKeysWithDictionary:dic];
            [self.educationArray addObject:model];
        }
    }
    
    self.trainingArray = [NSMutableArray arrayWithCapacity:0];
    if (keyedValues[@"training"] && [keyedValues[@"training"] count]) {
        for (NSDictionary *dic in keyedValues[@"training"]) {
            PMineResumeTrainingInfoModel *model = [[PMineResumeTrainingInfoModel alloc] init];
            [model setValuesForKeysWithDictionary:dic];
            [self.trainingArray addObject:model];
        }
    }
    
    self.projectArray = [NSMutableArray arrayWithCapacity:0];
    if (keyedValues[@"project"] && [keyedValues[@"project"] count]) {
        for (NSDictionary *dic in keyedValues[@"project"]) {
            PMineResumeProjectInfoModel *model = [[PMineResumeProjectInfoModel alloc] init];
            [model setValuesForKeysWithDictionary:dic];
            [self.projectArray addObject:model];
        }
    }
    
    self.credentArray = [NSMutableArray arrayWithCapacity:0];
    if (keyedValues[@"credent"] && [keyedValues[@"credent"] count]) {
        for (NSDictionary *dic in keyedValues[@"credent"]) {
            PMineResumeCredentInfoModel *model = [[PMineResumeCredentInfoModel alloc] init];
            [model setValuesForKeysWithDictionary:dic];
            [self.credentArray addObject:model];
        }
    }
    
    self.languageArray = [NSMutableArray arrayWithCapacity:0];
    if (keyedValues[@"language"] && [keyedValues[@"language"] count]) {
        for (NSDictionary *dic in keyedValues[@"language"]) {
            PMineResumeLanguageInfoModel *model = [[PMineResumeLanguageInfoModel alloc] init];
            [model setValuesForKeysWithDictionary:dic];
            [self.languageArray addObject:model];
        }
    }
    
    self.tagsArray = [NSMutableArray arrayWithCapacity:0];
    if (keyedValues[@"tags"] && [keyedValues[@"tags"] count]) {
        id data = [keyedValues[@"tags"] firstObject];
        if ([data isKindOfClass:[NSDictionary class]]) {
            for (NSDictionary *dic in keyedValues[@"tags"]) {
                PMineResumeTagsInfoModel *model = [[PMineResumeTagsInfoModel alloc] init];
                [model setValuesForKeysWithDictionary:dic];
                [self.tagsArray addObject:model];
            }
        }
    }
    self.tags = [NSMutableArray arrayWithCapacity:0];
    if (keyedValues[@"tags"] && [keyedValues[@"tags"] count]) {
        id data = [keyedValues[@"tags"] firstObject];
        if ([data isKindOfClass:[NSString class]]) {
            for (NSString *str in keyedValues[@"tags"]) {
                [self.tags addObject:str];
            }
        }
    }
    
    self.wordModel = [[PMineResumeWordInfoModel alloc] init];
    if (keyedValues[@"word"]) {
        [self.wordModel setValuesForKeysWithDictionary:keyedValues[@"intention"]];
    }
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    
}

- (id)copyWithZone:(NSZone *)zone {
    WorkerResumeInfoModel *model = [[[self class] allocWithZone:zone] init];
    model.userid = self.userid;
    model.auth_status = self.auth_status;
    model.chat_status = self.chat_status;
    model.favorite_status = self.favorite_status;
    model.name = self.name;
    model.nickname = self.nickname;
    model.avatar = self.avatar;
    model.residence = self.residence;
    model.age = self.age;
    model.sex = self.sex;
    model.education_cn = self.education_cn;
    model.experience_cn = self.experience_cn;
    model.position = self.position;
    model.telephone = self.telephone;
    model.email = self.email;
    model.weixin = self.weixin;
    model.weixin_img = self.weixin_img;
    model.specialty = self.specialty;
    model.current = self.current;
    model.current_cn = self.current_cn;
    model.price = self.price;
    model.percent = self.percent;
    model.audit = self.audit;
    model.status = self.status;
    model.is_graduate = self.is_graduate;
    
//    model.intentionModel = [[WorkerResumeIntentionInfoModel alloc] init];
//    if (self.intentionModel) {
//        model.intentionModel = [self.intentionModel copy];
//    }
    model.intentionModel = [[ResumeIntentionInfoModel alloc] init];
    if (self.intentionModel) {
        model.intentionModel = [self.intentionModel copy];
    }
    
    model.workArray = [NSMutableArray arrayWithCapacity:0];
    if (self.workArray && self.workArray.count) {
        for (PMineResumeWorkInfoModel *tempModel in self.workArray) {
            PMineResumeWorkInfoModel *model1 = [[PMineResumeWorkInfoModel alloc] init];
            model1 = [tempModel copy];
            [model.workArray addObject:model1];
        }
    }
    
    model.educationArray = [NSMutableArray arrayWithCapacity:0];
    if (self.educationArray && self.educationArray.count) {
        for (PMineResumeEducationInfoModel *tempModel in self.educationArray) {
            PMineResumeEducationInfoModel *model1 = [[PMineResumeEducationInfoModel alloc] init];
            model1 = [tempModel copy];
            [model.educationArray addObject:model1];
        }
    }
    
    model.trainingArray = [NSMutableArray arrayWithCapacity:0];
    if (self.trainingArray && self.trainingArray.count) {
        for (PMineResumeTrainingInfoModel *tempModel in self.trainingArray) {
            PMineResumeTrainingInfoModel *model1 = [[PMineResumeTrainingInfoModel alloc] init];
            model1 = [tempModel copy];
            [model.trainingArray addObject:model1];
        }
    }
    
    model.projectArray = [NSMutableArray arrayWithCapacity:0];
    if (self.projectArray && self.projectArray.count) {
        for (PMineResumeProjectInfoModel *tempModel in self.projectArray) {
            PMineResumeProjectInfoModel *model1 = [[PMineResumeProjectInfoModel alloc] init];
            model1 = [tempModel copy] ;
            [model.projectArray addObject:model1];
        }
    }
    
    model.credentArray = [NSMutableArray arrayWithCapacity:0];
    if (self.credentArray && self.credentArray.count) {
        for (PMineResumeCredentInfoModel *tempModel in self.credentArray) {
            PMineResumeCredentInfoModel *model1 = [[PMineResumeCredentInfoModel alloc] init];
            model1 = [tempModel copy];
            [model.credentArray addObject:model1];
        }
    }
    
    model.languageArray = [NSMutableArray arrayWithCapacity:0];
    if (self.languageArray && self.languageArray.count) {
        for (PMineResumeLanguageInfoModel *tempModel in self.languageArray) {
            PMineResumeLanguageInfoModel *model1 = [[PMineResumeLanguageInfoModel alloc] init];
            model1 = [tempModel copy];
            [model.languageArray addObject:model1];
        }
    }
    
    model.tagsArray = [NSMutableArray arrayWithCapacity:0];
    if (self.tagsArray && self.tagsArray.count) {
        for (PMineResumeTagsInfoModel *tempModel in self.tagsArray) {
            PMineResumeTagsInfoModel *model1 = [[PMineResumeTagsInfoModel alloc] init];
            model1 = [tempModel copy];
            [model.tagsArray addObject:model1];
        }
    }
    model.tags = [NSMutableArray arrayWithCapacity:0];
    if (self.tags && self.tags.count) {
        [model.tags addObjectsFromArray:self.tags];
    }
    
    model.wordModel = [[PMineResumeWordInfoModel alloc] init];
    if (self.wordModel) {
        model.wordModel = [self.wordModel copy];
    }
    
    return model;
}

@end
